package com.zhangwuji.im.DB.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.zhangwuji.im.DB.entity.Department;
import com.zhangwuji.im.DB.entity.User;
import com.zhangwuji.im.DB.entity.Group;
import com.zhangwuji.im.DB.entity.Message;
import com.zhangwuji.im.DB.entity.Session;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig departmentDaoConfig;
    private final DaoConfig userDaoConfig;
    private final DaoConfig groupDaoConfig;
    private final DaoConfig messageDaoConfig;
    private final DaoConfig sessionDaoConfig;

    private final DepartmentDao departmentDao;
    private final UserDao userDao;
    private final GroupDao groupDao;
    private final MessageDao messageDao;
    private final SessionDao sessionDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        departmentDaoConfig = daoConfigMap.get(DepartmentDao.class).clone();
        departmentDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        groupDaoConfig = daoConfigMap.get(GroupDao.class).clone();
        groupDaoConfig.initIdentityScope(type);

        messageDaoConfig = daoConfigMap.get(MessageDao.class).clone();
        messageDaoConfig.initIdentityScope(type);

        sessionDaoConfig = daoConfigMap.get(SessionDao.class).clone();
        sessionDaoConfig.initIdentityScope(type);

        departmentDao = new DepartmentDao(departmentDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);
        groupDao = new GroupDao(groupDaoConfig, this);
        messageDao = new MessageDao(messageDaoConfig, this);
        sessionDao = new SessionDao(sessionDaoConfig, this);

        registerDao(Department.class, departmentDao);
        registerDao(User.class, userDao);
        registerDao(Group.class, groupDao);
        registerDao(Message.class, messageDao);
        registerDao(Session.class, sessionDao);
    }
    
    public void clear() {
        departmentDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
        groupDaoConfig.clearIdentityScope();
        messageDaoConfig.clearIdentityScope();
        sessionDaoConfig.clearIdentityScope();
    }

    public DepartmentDao getDepartmentDao() {
        return departmentDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public GroupDao getGroupDao() {
        return groupDao;
    }

    public MessageDao getMessageDao() {
        return messageDao;
    }

    public SessionDao getSessionDao() {
        return sessionDao;
    }

}
